; Music of Nebulus (1988) (Hewson) (Dave Rogers)
; Ripped by Megachur the 03/06/2007

	write "NEBULUS.BIN"

music_date_rip	equ &0367
music_adr	equ &0130
first_theme	equ 0
last_theme	equ 0

	read "music_header_v1_0.asm"

;NEBULUSD.ASM     NEBULUS Sound driver (AMSTRAD)   ***** VERSION  5.0 *****

list
SOUNDCOD     EQU       music_begin	;28000            ;MACHINE CODE
;SOUNDATA     EQU       SOUNDCOD + #3A2  ;DATABLOCK LOAD

             NOLIST
list
ENVSINDEX    EQU       SOUNDATA+200
TUNESINDEX   EQU       ENVSINDEX+80

ENVCOUNTS    EQU 0    ;OFFSETS WITHIN CHANNEL STORES:
ENTCOUNTS    EQU 2
ENVPTR       EQU 4
ENTPTR       EQU 6
ENV0         EQU 8
ENT0         EQU 10
ENVADR       EQU 12
ENTADR       EQU 14

CHANACTIVE   EQU 16   ;1
MAINCOUNT    EQU 17   ;1
DATAPTR      EQU 18   ;2
CONPTR       EQU 20   ;2

  ;2 REMOVED

PITCHSHIFT   EQU 22   ;1
  ; 1 REMOVED
NOISEDIS     EQU 23   ;1
CH_ENABLE    EQU 24   ;1

  ;4 REMOVED

INTERVAL     EQU 25   ;1
CURRENTNOTE  EQU 26   ;1
CHORDTOGGLE  EQU 27   ;1

;             ORG  SOUNDCOD
;             WRITE "NEBULUSD.BIN"
START        DEFL $

;--------------------------------------
JUMPBLOCK:      JP PLAY
                JP SILENCE
;
.init_music
;
                LD E,1
                LD A,1
;-------------------------------------------------

STARTACHAN:     DI
                LD C,A              ; A/C=CHAN NUM E=TUNEBLOCK NUM
                CALL FINDBLOC       ; 1. PUT BLOCK ADDRESS IN HL, GIVEN E
                LD A,(HL)           ; 2. LOOK FOR START CHANNEL MARKER
                CP 4
                JR Z,CHANALT
                CP 9
                JR NC,NOCHANMARKER
                LD C,A
                INC HL
NOCHANMARKER:   LD A,C
                DEC A
                JR Z ,CH1
                DEC A
                JR Z,CH2
                JP   CH3

CHANALT:        INC HL
                LD A,(STORE2+CHANACTIVE) ;ch2 = 1st choice (gets chorused)
                OR A
                JR Z,CH2
                LD A,(STORE1+CHANACTIVE) ;ch1 = 2nd choice (mono)
                OR A
                JR Z,CH1
CH3:            XOR A                    ;ch3 = last resort. Stops chorus of
                LD (STORE3+INTERVAL),A   ;other chan. (Only choice if tune is
                INC A                    ;playing)
                LD (STORE3+MAINCOUNT),A
                LD (STORE3+DATAPTR),HL
                LD (STORE3+CHANACTIVE),A
                EI
                RET
CH2:            LD (STORE2+INTERVAL),A
                INC A
                LD (STORE2+MAINCOUNT),A
                LD (STORE2+DATAPTR),HL
                LD (STORE2+CHANACTIVE),A
                EI
                RET
CH1:            LD (STORE1+INTERVAL),A
                INC A
                LD (STORE1+MAINCOUNT),A
                LD (STORE1+DATAPTR),HL
                LD (STORE1+CHANACTIVE),A
                EI
                RET

;-------------------------------------
;
.stop_music
;
SILENCE:        DI
                LD A,1+2+4+8+16+32
                LD (BUFF+7),A              ;ALL GATES SHUT
                XOR A
                LD  (STORE1+CHANACTIVE),A  ;CHANNEL-ACTIVE-FLAGS 0
                LD  (STORE2+CHANACTIVE),A
                LD  (STORE3+CHANACTIVE),A
                LD (STORE1+INTERVAL),A     ;ZEROED FOR "CHANALT" SOUND FX
                LD (STORE2+INTERVAL),A
                LD (STORE3+INTERVAL),A
                LD (STORE1+PITCHSHIFT),A
                LD (STORE2+PITCHSHIFT),A
                LD (STORE3+PITCHSHIFT),A
                LD (BUFF+8),A              ;VOLUME REGISTERS 0
                LD (BUFF+9),A
                LD (BUFF+10),A

ALL13REGS:      LD HL,BUFF+13              ;A STILL = 0
                LD DE,#F40D                ;13
                JP NEXTREG

;-------------------------SUBROUTINES
FINDBLOC:       LD   A,E
                ADD  A,A
                ADD  A,TUNESINDEX AND #00FF
                LD   L,A
                ADC  A,TUNESINDEX AND #FF00 /256
                SUB  L
                LD   H,A
                LD   E,(HL)
                INC  HL
                LD   D,(HL)
                LD HL,SOUNDATA
                ADD HL,DE
                RET

FINDENV:        LD   A,E
                ADD  A,A
                ADD  A,ENVSINDEX AND #00FF
                LD   E,A
                ADC  A,ENVSINDEX AND #FF00 / 256
                SUB  E
                LD   D,A

                LD  A,(DE)
                ADD A,SOUNDATA AND #00FF
                LD  C,A

                INC  DE
                LD  A,(DE)
                ADC A,SOUNDATA AND #FF00 / 256
                LD B,A
                RET

;-------------------MAIN CALL--------EVERY 1/50 SECOND-----------------------
;
.play_music
;
PLAY:           LD HL,STOPHANG
                LD (HL),20

                LD A,(STORE1+CHANACTIVE)
                OR A
                JR Z,C2
                LD  IX,STORE1      ;---DO CHANNEL 1 (IX POINTS TO CHAN1 STORE)
                LD IY,BUFF+8
                LD HL,(BUFF)       ;CURRENT PITCH
                LD (PITCHTEMP),HL
                LD HL,(STORE1+DATAPTR)
                CALL TESTCHAN
                LD (BUFF),HL

C2:             LD A,(STORE2+CHANACTIVE)
                OR A
                JR Z,C3
                LD  IX,STORE2      ;---DO CHANNEL 2
                LD IY,BUFF+9
                LD HL,(BUFF+2)
                LD (PITCHTEMP),HL
                LD HL,(STORE2+DATAPTR)
                CALL TESTCHAN
                LD (BUFF+2),HL

C3:             LD A,(STORE3+CHANACTIVE)
                OR A
                JR Z,CHORUS

                LD   IX,STORE3     ;---DO CHANNEL 3
                LD IY,BUFF+10
                LD HL,(BUFF+4)
                LD (PITCHTEMP),HL
                LD HL,(STORE3+DATAPTR)
                CALL TESTCHAN
                JP NOCHORUS

CHORUS:         OR H    ;A ALWAYS 0 HERE
                OR L
                JR Z,NOCHORUS     ;PAUSES
                DEC L
                DEC L         ;NO PITCH VALS NEAR 256 BOUNDARIES
                LD A,(BUFF+9)
                LD (BUFF+10),A
NOCHORUS:       LD (BUFF+4),HL

                CALL DOENSE

ALLREGIST:      XOR  A
                LD   HL,BUFF+10            ;10
                LD   DE,#F40A              ;10
NEXTREG:        LD   B,D
                OUT  (C),E                 ;OUTPUT REGISTER NO
                LD   BC,63168           ;(#F6*256+%11000000)
                OUT  (C),C                 ;TELL PSG TO LATCH REG NO
                OUT  (C),A                 ;PSG TO INACTIVE
                LD   B,D
                LD   C,(HL)                ;C=REGISTER DATA
                DEC  HL
                OUT  (C),C                 ;OUTPUT REGISTER DATA
                LD   BC,63104           ;(#F6*256+%10000000)
                OUT  (C),C                 ;TELL PSG TO READ REG DATA
                OUT  (C),A                 ;PSG TO INACTIVE
                DEC  E
                JP   P,NEXTREG
                RET                ;-------------->>>>>>> OUT

;FOR EACH OF THE 3 CHANNELS:

TESTCHAN:       DEC  (IX+MAINCOUNT)
                JP NZ,DOENV_ENT

DECI:           LD   A,(HL)         ;A=(PTR)
                INC  HL
                LD   E,(HL)         ;E=(PTR+1)
                INC HL
;-----------------------

SUBSELECT:   OR   A
             JP   Z,DOPAUSE
             CP   9
             JP   C,STARTLOOP
             CP   101
             JP   C,NEWNOTE

           SUB 230         ;VALS NOW SEQUENTIAL TO ALLOW DEC A
           JR  Z,NOISE
           DEC A
           JR  Z,NOISENOCHECK
           DEC A
           JR  Z,QUICKOUT
           DEC A
           JR  Z,NEWENV
           DEC A
           JR  Z,NEWENT
           DEC A
           JR  Z,NEWENSE
           DEC A
           JP  Z,SETINTERVAL
           DEC A
           JR  Z,NEWKEY
           DEC A
           JR  Z,GONEWBLOC
           DEC A
           JR  Z,RETCONBLOC

          ;FOLLOW THROUGH=SAFETY NET
KILLCHAN:       LD (IX+CHANACTIVE),0
                LD (IY+0),0
                RET

QUICKOUT:       LD (IX+MAINCOUNT),1     ;TIME SHARER
                DEC HL
                LD (IX+DATAPTR),L
                LD (IX+DATAPTR+1),H
                LD HL,0
                RET

STARTLOOP:      PUSH IX                 ;A=CHAN E=TUNEBLOC
                PUSH HL
                LD HL,STOPHANG     ;JUST-IN-CASE!
                DEC (HL)
                RET Z
                CALL STARTACHAN
                POP HL
                POP IX
                JP DECI

NOISE:          LD A,(STORE3+CHANACTIVE)   ;NO TUNE-DRUMS IF CH3 ACTIVE
                OR A
                JR NZ, DECI
NOISENOCHECK:   LD   A,E
                LD   (BUFF+6),A            ;NOISEPITCH
                LD A,1
                LD   (NSEFLAG),A
                JP   DECI

NEWKEY:         LD   (IX+PITCHSHIFT),E
                JP   DECI

NEWENT:         CALL FINDENV       ;RETURNS WITH ENVELOPE ADDRESS IN BC
                LD (IX+ENTADR),C
                LD (IX+ENTADR+1),B
                JP DECI

NEWENV:         CALL FINDENV
                LD (IX+ENVADR),C
                LD (IX+ENVADR+1),B
                JP DECI

NEWENSE:        CALL FINDENV
                LD (ENSSTORE+12),BC
                JP DECI

GONEWBLOC:      LD   (IX+CONPTR+1),H
                LD   (IX+CONPTR),L
                CALL FINDBLOC
                JP   DECI

RETCONBLOC:     LD   H,(IX+CONPTR+1)
                LD   L,(IX+CONPTR)
                JP DECI

SETINTERVAL:    LD (IX+INTERVAL),E
                JP DECI


NEWNOTE:        ADD  A,(IX+PITCHSHIFT)

DOPAUSE:        LD   (IX+MAINCOUNT),E
                LD   (IX+CURRENTNOTE),A
                LD   (IX+DATAPTR+1),H
                LD   (IX+DATAPTR),L

PITCHTAB        EQU  SOUNDATA

                ADD  A,A
                ADD  A,PITCHTAB AND #00FF
                LD   L,A
                ADC  A,PITCHTAB AND #FF00 /256
                SUB  L
                LD   H,A                 ;HL=ADR OF PITCH IN TABLE
                LD   DE,PITCHTEMP
                LDI
                LDI

                LD (IY+0),0

                PUSH IX                  ;RESTART ENV/ent
                POP  DE                  ;DE=START OF CHAN STORE
                LD   HL,8
                ADD  HL,DE               ;HL=START OF CHAN STORE+8
                LDI
                LDI
                LDI
                LDI
                LDI
                LDI
                LDI
                LDI

                XOR A
                LD HL,NSEFLAG
                OR   (HL)                  ;TEST NOISEFLAG
                LD   (HL),0                ;RESET EVERY TIME!
                LD   L,(IX+NOISEDIS)       ;DEFAULT DISABLE
                JR   Z,GATING

NOISEON:        LD  HL,(ENSSTORE+ENVADR)   ;RESTART NOISE ENVELOPE
                LD  (ENSSTORE+ENVPTR),HL
                LD  HL,00
                LD  (ENSSTORE),HL          ;L=0,NO NOISEDISABLE

GATING:         LD   A,(BUFF+7)
                AND  (IX+CH_ENABLE)     ;CHAN ENABLE (PITCH AND NOISE ON)
                OR   L                  ;NOISE DISABLE
                AND  32+16+8+4+2+1      ;SAFETY, TOP 2 BITS MUST REMAIN OFF
                LD   (BUFF+7),A         ;FINAL RESULT IN A
;------------------------------------

DOENV_ENT:      PUSH IX
                POP  HL
                LD   D,(IX+ENVPTR+1)
                LD   E,(IX+ENVPTR)
                INC  (HL)
                LD   A,(DE)
                SUB  (HL)
                JP  NZ,NOENV
                LD   (HL),A
                INC DE
                LD  A,(DE)

                ADD (IY+0)
                SUB  128
                LD   (IY+0),A

                INC  DE
                INC  HL
                INC  (HL)
                LD   A,(DE)
                SUB  (HL)
                JP  NZ,NOENV    ;*****
                LD   (HL),A
                INC  DE
                LD   A,(DE)
                INC  A
                JP   NZ,NEXTSECT
                LD   D,(IX+ENVADR+1)
                LD   E,(IX+ENVADR)
NEXTSECT:       LD   (IX+ENVPTR+1),D
                LD   (IX+ENVPTR),E

;-----------------
NOENV:          LD HL,(PITCHTEMP)   ;IS IT A PAUSE ?
                LD A,H
                OR L
                RET Z
                LD A,(IX+INTERVAL)  ;IS IT A CHORD ?
                OR A
                JR NZ,DOCHORD
DOENT:          PUSH IX
                POP  HL
                INC HL
                INC HL
                LD   D,(IX+ENTPTR+1)
                LD   E,(IX+ENTPTR)
                INC  (HL)
                LD   A,(DE)
                SUB  (HL)
                JP  NZ,NOPITCH
                LD   (HL),A
                INC DE
                LD  A,(DE)
                LD  C,A
                INC  DE
                INC  HL
                INC  (HL)
                LD   A,(DE)
                SUB  (HL)
                JP  NZ,DOPITCH
                LD   (HL),A
                INC  DE
                LD   A,(DE)
                INC  A
                JP   NZ,NEXTSECT2
                LD   D,(IX+ENTADR+1)
                LD   E,(IX+ENTADR)
NEXTSECT2:      LD   (IX+ENTPTR+1),D
                LD   (IX+ENTPTR),E

DOPITCH:        LD HL,(PITCHTEMP)
                LD B,0
                ADD  HL,BC
                LD   C,128
                SBC  HL,BC       ;HL=NEW PITCH
GETOUT:         RET

NOPITCH:        LD HL,(PITCHTEMP)
                RET

DOCHORD:        DEC (IX+CHORDTOGGLE)
                LD A,(IX+CURRENTNOTE)
                JR Z,FINDSETPITCH
                ADD (IX+INTERVAL)
                LD (IX+CHORDTOGGLE),1

;PITCHTAB        EQU  SOUNDATA

FINDSETPITCH:   ADD  A,A
                ADD  A,PITCHTAB AND #00FF
                LD   L,A
                ADC  A,PITCHTAB AND #FF00 /256
                SUB  L
                LD   H,A   ;HL=ADR OF PITCH IN TABLE

                LD   E,(HL)
                INC HL
                LD  D,(HL)
                EX HL,DE
                RET
;---------------------
DOENSE:         LD DE,(ENSSTORE+4)
                LD HL,ENSSTORE
                INC  (HL)
                LD   A,(DE)
                SUB  (HL)
                RET  NZ
                LD   (HL),A
                INC DE
                LD  A,(DE)
                LD  C,A
                INC  DE
                INC  HL
                INC  (HL)
                LD   A,(DE)
                SUB  (HL)
                JP  NZ,DONSE
                LD   (HL),A
                INC  DE
                LD   A,(DE)
                INC  A
                JP   NZ,NEXTSECT3
                LD   DE,(ENSSTORE+12)
NEXTSECT3:      LD   (ENSSTORE+4),DE

DONSE:          LD HL, BUFF+6
                LD   A,(HL)
                ADD  A,C
                SUB  128
                LD   (HL),A
                CP 17
                RET C
NOISEOFF:       INC HL    ;HL=BUFF+7
                LD A,(HL)
                OR 32+16+8
                LD (HL),A
                RET

;---------------------

BUFF:     DW  00       ;A PITCH
          DW  00       ;B PITCH
          DW  00       ;C PITCH
          DB  0        ;NOISE PITCH
          DB  32+16+8  ;GATES
          DB  0        ;A VOL
          DB  0        ;B VOL
          DB  0        ;C VOL
          DB  255,255  ;HARD ENV LEN
          DB  12       ;HARD ENV TYPE

PITCHTEMP:  DW 00

NSEFLAG:    DB 0

STOPHANG:   DB 0

ENSSTORE: DW 00 ;ENSCOUNTS
          DW 10
          DW 00 ;ENSPTR
          DW 04
          DW 00 ;ENS0
          DW 18
          DW 00 ;ENSADR
;----------------------------------
;CHANNEL STORES

STORE1:   DW  00     ;ENV COUNTS
          DW  00     ;ENT COUNTS
          DW  00     ;ENV PTR
          DW  00     ;ENT PTR

          DW  00     ;ENV ZEROERS
          DW  00     ;ENT ZEROERS
          DW  00     ;ENV ADDR
          DW  00     ;ENT ADDR

          DB  0      ;CHAN ACTIVE
          DB  0      ;MAIN COUNT
          DW  00     ;MAIN PTR
          DW  00     ;CON PTR
          DB  0      ;PITCHSHIFT
          DB   8        ;NOISE DIS
          DB  32+16+4+2-4 ;CHAN ENABLE  (-4 'COS CHORUS=CH3 ALWAYS ON)
          DB  0
          DB  0
          DB  0

STORE2: DW  00
        DW  00
        DW  00
        DW  00

        DW  00
        DW  00
        DW  00
        DW  00

        DB  0
        DB  0
        DW  00
        DW  00
        DB  0
        DB  16
        DB  32+8+4+1-4
        DB  0
        DB  0
        DB  0

STORE3: DW  00
        DW  00
        DW  00
        DW  00

        DW  00
        DW  00
        DW  00
        DW  00

        DB  0
        DB  0
        DW  00
        DW  00
        DB  0
        DB  32
        DB  16+8+2+1
        DB  0
        DB  0
        DB  0

SPARE:  DB 42
;------------------------------------------------
SOUNDATA
	db #00,#00,#35,#1c,#9f,#1a,#21,#19
	db #b8,#17,#63,#16,#21,#15,#f2,#13
	db #d3,#12,#c5,#11,#c5,#10,#d4,#0f
	db #f1,#0e,#1a,#0e,#50,#0d,#90,#0c
	db #dc,#0b,#32,#0b,#91,#0a,#f9,#09
	db #6a,#09,#e2,#08,#63,#08,#ea,#07
	db #79,#07,#0d,#07,#a8,#06,#48,#06
	db #ee,#05,#99,#05,#48,#05,#fc,#04
	db #b5,#04,#71,#04,#31,#04,#f5,#03
	db #bc,#03,#87,#03,#54,#03,#24,#03
	db #f7,#02,#cc,#02,#a4,#02,#7e,#02
	db #5a,#02,#39,#02,#19,#02,#fb,#01
	db #de,#01,#c3,#01,#aa,#01,#92,#01
	db #7b,#01,#66,#01,#52,#01,#3f,#01
	db #2d,#01,#1c,#01,#0c,#01,#fd,#00
	db #ef,#00,#e2,#00,#d5,#00,#c9,#00
	db #be,#00,#b3,#00,#a9,#00,#a0,#00
	db #97,#00,#8e,#00,#86,#00,#7f,#00
	db #78,#00,#71,#00,#6a,#00,#65,#00
	db #5f,#00,#5a,#00,#55,#00,#50,#00
	db #4b,#00,#47,#00,#43,#00,#3f,#00
	db #3c,#00,#38,#00,#35,#00,#32,#00
	db #2f,#00,#2d,#00,#2a,#00,#28,#00
	db #26,#00,#24,#00,#22,#00,#20,#00
	db #1e,#00,#1c,#00,#1b,#00,#00,#78
	db #7c,#01,#80,#01,#8d,#01,#97,#01
	db #9e,#01,#a8,#01,#b5,#01,#c5,#01
	db #d2,#01,#d9,#01,#e3,#01,#f3,#01
	db #fd,#01,#07,#02,#20,#02,#27,#02
	db #31,#02,#3b,#02,#42,#02,#55,#02
	db #5c,#02,#66,#02,#73,#02,#7d,#02
	db #8d,#02,#97,#02,#a4,#02,#ae,#02
	db #b5,#02,#bc,#02,#c3,#02,#d0,#02
	db #da,#02,#e1,#02,#eb,#02,#f5,#02
	db #02,#03,#0f,#03,#10,#03,#01,#f7
	db #8f,#04,#14,#03,#d8,#03,#8f,#04
	db #02,#29,#02,#30,#02,#43,#92,#04
	db #fd,#04,#1a,#05,#31,#05,#74,#05
	db #8f,#05,#aa,#05,#ed,#05,#46,#06
	db #57,#06,#74,#06,#77,#06,#7a,#06
	db #7d,#06,#80,#06,#84,#06,#93,#06
	db #a2,#06,#b0,#06,#b9,#06,#c2,#06
	db #cd,#06,#d1,#06,#e0,#06,#10,#07
	db #1d,#07,#26,#07,#35,#07,#44,#07
	db #4d,#07,#5c,#07,#65,#07,#7b,#07
	db #86,#07,#9c,#07,#b9,#07,#d4,#07
	db #e7,#07,#f9,#07,#06,#40,#06,#43
	db #06,#46,#06,#4a,#c8,#80,#c8,#ff
	db #01,#83,#01,#01,#82,#06,#02,#7e
	db #05,#c8,#80,#c8,#ff,#01,#8c,#01
	db #01,#81,#03,#c8,#80,#c8,#ff,#01
	db #81,#0c,#04,#7f,#0c,#ff,#01,#86
	db #01,#01,#82,#01,#c8,#80,#c8,#ff
	db #01,#89,#01,#04,#7f,#04,#08,#7f
	db #05,#c8,#80,#c8,#ff,#01,#8b,#01
	db #02,#80,#01,#02,#7f,#04,#02,#7f
	db #06,#c8,#80,#c8,#ff,#01,#89,#01
	db #02,#7f,#01,#09,#7f,#04,#c8,#80
	db #c8,#ff,#01,#75,#01,#01,#8d,#01
	db #ff,#01,#8a,#01,#0c,#7f,#09,#c8
	db #80,#c8,#ff,#01,#e3,#01,#01,#75
	db #06,#01,#e3,#01,#01,#75,#0c,#c8
	db #80,#c8,#ff,#01,#8c,#01,#01,#7c
	db #01,#c8,#80,#c8,#ff,#01,#8e,#01
	db #01,#7e,#07,#c8,#80,#c8,#ff,#01
	db #81,#02,#01,#7f,#02,#01,#81,#01
	db #01,#7f,#01,#01,#81,#02,#01,#7f
	db #02,#02,#81,#01,#02,#7f,#01,#ff
	db #01,#8b,#01,#01,#74,#01,#ff,#02
	db #83,#01,#01,#7d,#02,#02,#83,#01
	db #ff,#01,#92,#02,#01,#6e,#04,#01
	db #92,#02,#ff,#01,#54,#01,#01,#ac
	db #02,#ff,#09,#89,#03,#01,#77,#12
	db #01,#82,#01,#01,#81,#02,#01,#82
	db #01,#01,#81,#02,#ff,#01,#96,#01
	db #01,#6c,#01,#ff,#01,#7f,#02,#01
	db #7e,#02,#c8,#80,#c8,#ff,#01,#8b
	db #01,#01,#7d,#03,#01,#7f,#02,#c8
	db #80,#c8,#ff,#01,#78,#04,#01,#96
	db #02,#c8,#80,#c8,#ff,#04,#81,#09
	db #01,#89,#01,#04,#81,#09,#01,#89
	db #01,#04,#81,#09,#ff,#02,#e3,#01
	db #01,#e3,#01,#01,#e3,#01,#ff,#01
	db #89,#01,#01,#81,#04,#02,#7f,#0e
	db #c8,#80,#c8,#ff,#02,#7b,#04,#02
	db #8c,#06,#c8,#80,#c8,#ff,#02,#84
	db #04,#02,#81,#c8,#ff,#01,#8c,#01
	db #c8,#80,#c8,#ff,#01,#85,#01,#01
	db #80,#01,#ff,#01,#87,#01,#02,#81
	db #08,#02,#7f,#0e,#c8,#80,#c8,#ff
	db #01,#86,#01,#01,#81,#01,#c8,#80
	db #c8,#ff,#01,#83,#04,#01,#7c,#c8
	db #ff,#01,#86,#01,#01,#7f,#01,#c8
	db #80,#c8,#ff,#01,#89,#01,#01,#83
	db #01,#c8,#80,#c8,#ff,#01,#8f,#01
	db #02,#7f,#04,#04,#7f,#08,#c8,#80
	db #c8,#ff,#01,#8f,#01,#01,#7f,#04
	db #02,#7f,#08,#c8,#80,#c8,#ff,#ff
	db #ff,#00,#01,#02,#01,#02,#02,#ed
	db #00,#e9,#06,#00,#01,#ea,#00,#ec
	db #00,#ee,#07,#ee,#07,#ee,#07,#ed
	db #02,#ee,#07,#ee,#07,#ee,#07,#ee
	db #0a,#ee,#0a,#ec,#24,#ee,#0a,#ee
	db #0a,#ed,#04,#ec,#00,#ee,#0a,#ee
	db #0a,#ec,#30,#ee,#0a,#ee,#0a,#e9
	db #06,#ec,#00,#ed,#00,#e8,#ee,#0d
	db #ed,#03,#ee,#0d,#ed,#02,#ee,#0d
	db #ed,#00,#ee,#0d,#ed,#02,#ee,#0d
	db #ec,#18,#ed,#03,#ee,#0d,#ed,#02
	db #ee,#0d,#ed,#00,#ee,#0d,#ed,#02
	db #ee,#0d,#ec,#00,#ee,#07,#ed,#01
	db #ee,#07,#ed,#0e,#ee,#07,#ee,#07
	db #ee,#07,#e6,#06,#00,#0c,#ee,#07
	db #ed,#05,#e8,#ee,#10,#e9,#0c,#ee
	db #0a,#ee,#0a,#ee,#0a,#ed,#02,#ee
	db #0a,#ee,#0a,#e9,#06,#ed,#06,#ee
	db #07,#ed,#07,#ee,#0a,#ee,#0a,#ed
	db #04,#ee,#0a,#ee,#0a,#ee,#07,#ed
	db #02,#ee,#07,#ee,#10,#ee,#0d,#ee
	db #0d,#ee,#0d,#ee,#0d,#e9,#05,#ed
	db #01,#ee,#0c,#e9,#04,#ee,#0c,#e9
	db #1f,#ee,#0c,#e9,#21,#ee,#0c,#e9
	db #00,#ee,#0c,#ee,#11,#01,#01,#f0
	db #ed,#00,#e9,#07,#00,#02,#ea,#0d
	db #ed,#18,#ee,#07,#ed,#00,#ee,#08
	db #ee,#09,#ee,#08,#ee,#09,#ed,#02
	db #ee,#08,#ee,#0c,#ee,#09,#ee,#0c
	db #ee,#08,#ee,#09,#e9,#05,#ee,#0b
	db #ee,#0b,#ed,#04,#ee,#0b,#ee,#0b
	db #e9,#09,#ed,#0c,#e8,#ee,#0e,#e9
	db #07,#ea,#00,#ee,#10,#ee,#10,#ed
	db #0b,#ee,#10,#ee,#10,#ed,#02,#ea
	db #0d,#00,#0c,#ec,#0c,#ee,#08,#ee
	db #0c,#ee,#09,#ee,#0c,#ee,#08,#ee
	db #0c,#ee,#07,#ec,#00,#e9,#04,#ed
	db #0c,#e8,#ee,#10,#00,#60,#ee,#0f
	db #ed,#09,#ee,#0f,#ed,#1c,#ee,#10
	db #ee,#10,#ed,#07,#ee,#0f,#ed,#04
	db #ee,#0f,#ed,#10,#ea,#15,#ee,#0c
	db #ed,#04,#ee,#09,#ed,#0e,#ee,#0c
	db #ed,#02,#ee,#09,#ee,#10,#ee,#0d
	db #ed,#15,#ee,#0d,#ed,#1a,#ee,#0d
	db #ed,#21,#ee,#0d,#e9,#04,#ed,#0d
	db #ee,#0c,#e9,#1f,#ee,#0c,#e9,#21
	db #ee,#0c,#e9,#21,#ee,#0c,#e9,#21
	db #ee,#0c,#ee,#11,#01,#01,#f0,#ef
	db #08,#ee,#e6,#01,#2d,#0c,#eb,#14
	db #e6,#01,#2d,#06,#e6,#01,#2d,#06
	db #e6,#06,#2d,#0c,#e6,#01,#2d,#06
	db #e6,#01,#2b,#0c,#e6,#01,#2b,#06
	db #e6,#01,#2b,#06,#e6,#01,#2b,#06
	db #e6,#06,#2a,#06,#e6,#01,#2a,#06
	db #e6,#01,#28,#06,#e6,#01,#28,#06
	db #e6,#01,#2d,#0c,#e6,#01,#2d,#06
	db #e6,#01,#2d,#06,#e6,#06,#28,#0c
	db #e6,#01,#2d,#06,#e6,#01,#2f,#0c
	db #e6,#01,#2f,#06,#e6,#01,#2f,#06
	db #e6,#01,#2f,#06,#e6,#06,#32,#06
	db #e6,#01,#32,#06,#e6,#06,#34,#06
	db #e6,#01,#34,#06,#ef,#40,#06,#e6
	db #01,#3e,#06,#40,#06,#3e,#06,#40
	db #0c,#3e,#06,#40,#0c,#3e,#06,#40
	db #06,#3e,#06,#43,#06,#42,#06,#43
	db #0c,#ef,#40,#06,#e6,#01,#3e,#06
	db #40,#06,#3e,#06,#40,#0c,#3b,#06
	db #3e,#0c,#3b,#06,#3e,#1e,#00,#06
	db #ef,#e6,#01,#32,#06,#eb,#14,#e6
	db #01,#2d,#06,#e6,#01,#2a,#06,#e6
	db #01,#26,#06,#e6,#06,#31,#06,#e6
	db #01,#2d,#06,#e6,#01,#2a,#06,#e6
	db #01,#25,#06,#e6,#01,#2a,#06,#e6
	db #01,#2d,#06,#e6,#01,#31,#06,#e6
	db #01,#2d,#06,#e6,#06,#2a,#06,#e6
	db #01,#2d,#06,#e6,#01,#31,#06,#e6
	db #01,#2d,#06,#ef,#4a,#18,#49,#18
	db #45,#06,#44,#06,#42,#06,#44,#0c
	db #45,#12,#4a,#18,#49,#18,#4c,#0c
	db #4a,#06,#49,#0c,#45,#12,#ef,#34
	db #0c,#34,#06,#34,#06,#34,#0c,#34
	db #06,#36,#0c,#36,#06,#36,#06,#36
	db #06,#37,#06,#37,#06,#39,#06,#39
	db #06,#ef,#e6,#01,#23,#06,#eb,#14
	db #e6,#01,#2a,#06,#e6,#01,#2f,#06
	db #e6,#01,#2a,#06,#e6,#06,#23,#06
	db #e6,#01,#2a,#06,#e6,#01,#2d,#06
	db #e6,#01,#2a,#06,#e6,#01,#23,#06
	db #e6,#01,#2a,#06,#e6,#01,#2b,#06
	db #e6,#01,#2a,#06,#e6,#06,#2d,#06
	db #e6,#01,#2b,#06,#e6,#01,#2a,#06
	db #e6,#01,#26,#06,#ef,#e6,#01,#32
	db #06,#31,#06,#e6,#01,#2f,#06,#31
	db #06,#e6,#06,#00,#06,#32,#12,#e6
	db #01,#32,#06,#31,#06,#e6,#01,#2f
	db #06,#31,#06,#e6,#06,#00,#06,#32
	db #12,#e6,#01,#35,#06,#34,#06,#e6
	db #01,#32,#06,#34,#06,#e6,#06,#00
	db #06,#35,#12,#ea,#0f,#e6,#01,#39
	db #30,#e6,#01,#38,#60,#e6,#01,#36
	db #60,#e6,#01,#33,#60,#e6,#01,#39
	db #60,#e6,#01,#38,#60,#e6,#01,#36
	db #60,#e6,#01,#33,#60,#ef,#4a,#18
	db #49,#18,#45,#06,#44,#06,#42,#06
	db #44,#0c,#45,#12,#45,#60,#ef,#34
	db #0c,#31,#06,#2d,#0c,#2a,#06,#2d
	db #06,#2a,#06,#31,#06,#2f,#06,#31
	db #06,#34,#06,#36,#06,#34,#06,#31
	db #06,#2d,#06,#ef,#00,#60,#ef,#00
	db #06,#ef,#00,#06,#ef,#00,#06,#ef
	db #00,#06,#ef,#e9,#04,#e9,#06,#ea
	db #00,#e8,#44,#04,#50,#04,#44,#04
	db #50,#04,#f0,#04,#04,#18,#e9,#22
	db #ea,#0a,#e8,#54,#12,#56,#14,#58
	db #22,#f0,#04,#e9,#22,#ea,#0a,#e8
	db #54,#12,#56,#16,#58,#1c,#f0,#e9
	db #04,#e9,#24,#ea,#20,#e8,#3a,#12
	db #f0,#04,#e9,#22,#ea,#13,#e8,#5f
	db #1e,#f0,#04,#e9,#24,#ea,#16,#e8
	db #4d,#0b,#f0,#04,#00,#04,#00,#01
	db #f0,#04,#e9,#24,#ea,#11,#eb,#17
	db #e8,#e7,#09,#4d,#0f,#eb,#14,#f0
	db #04,#e9,#01,#ea,#0a,#eb,#0f,#e8
	db #e7,#0b,#00,#10,#e9,#1e,#eb,#1e
	db #e8,#e7,#01,#00,#3f,#e9,#05,#54
	db #04,#00,#04,#50,#04,#00,#04,#4e
	db #04,#00,#04,#4c,#03,#00,#04,#49
	db #02,#00,#03,#48,#02,#f0,#04,#e9
	db #04,#e9,#24,#ea,#18,#eb,#18,#e8
	db #e7,#09,#4a,#18,#f0,#04,#e9,#02
	db #ea,#11,#e8,#30,#9a,#f0,#04,#e9
	db #23,#ea,#11,#eb,#12,#e8,#e7,#06
	db #43,#26,#f0,#04,#e9,#04,#e9,#1c
	db #ea,#1b,#e8,#5a,#09,#5a,#07,#5a
	db #09,#5a,#0d,#f0,#04,#e9,#0b,#ea
	db #0e,#e8,#5c,#06,#f0,#04,#eb,#1d
	db #e9,#06,#e8,#e7,#08,#18,#03,#eb
	db #14,#f0,#04,#e9,#04,#e9,#19,#ea
	db #1a,#e8,#48,#11,#f0,#04,#e9,#03
	db #ea,#10,#e8,#4e,#42,#e9,#0b,#ea
	db #04,#eb,#06,#e8,#e7,#03,#29,#42
	db #00,#01,#f0,#04,#e9,#0b,#ea,#08
	db #e8,#57,#06,#f0,#01,#00,#01,#00
	db #04,#02,#29,#03,#2a,#ed,#00,#ec
	db #00,#e9,#09,#ea,#0d,#2d,#20,#29
	db #20,#28,#60,#f0,#ed,#00,#ec,#13
	db #e9,#07,#39,#08,#3c,#08,#40,#08
	db #45,#08,#35,#08,#39,#08,#3c,#08
	db #41,#08,#eb,#03,#e7,#01,#43,#50
	db #f0,#ed,#00,#ec,#00,#e9,#09,#ea
	db #0d,#47,#08,#45,#08,#48,#08,#45
	db #08,#43,#08,#45,#10,#41,#08,#40
	db #60,#f0,#01,#02,#01,#02,#2c,#ed
	db #00,#ec,#00,#e9,#09,#ea,#00,#e8
	db #35,#10,#39,#10,#3c,#63,#f0,#ed
	db #00,#ec,#00,#e9,#09,#ea,#00,#e8
	db #35,#08,#36,#10,#3a,#08,#3c,#63
	db #f0,#00,#01,#f0,#00,#00,#00,#00
	db #c9,#25,#0d,#2f,#0d,#3e,#08,#01
	db #cd,#89,#81,#4f,#20,#01,#04,#0a
	db #e6,#04,#20,#11,#3e,#02,#01,#cd
	db #89,#81,#4f,#20,#01,#04,#0a,#1f
	db #d0,#e6,#02,#20,#ef,#21,#25,#0d
	db #cd,#0c,#0d,#7a,#f5,#21,#2f,#0d
	db #cd,#0c,#0d,#f1,#b2,#32,#39,#0d
	db #37,#c9,#11,#05,#00,#7e,#23,#01
	db #cd,#89,#81,#4f,#20,#01,#04,#0a
	db #a6,#23,#20,#01,#37,#cb,#12,#1d
	db #20,#eb,#c9,#05,#80,#08,#08,#08
	db #20,#04,#04,#03,#08,#09,#10,#09
	db #01,#09,#02,#09,#04,#09,#08,#00
	db #00,#00,#00
FINISH          DEFL $
                LIST
;                CLOSE
;START           DEFL START
;FINISH          DEFL FINISH
LENGTH          DEFL FINISH-START

.game_name
	db "Nebulus",0
.game_year
	db "1988",0
.game_publisher
	db "Hewson",0
.music_author
	db "Dave Rogers",0
.music_comment
	db "NEBULUSD.ASM NEBULUS Sound driver (AMSTRAD) ***** VERSION  5.0 *****",0

	read "music_end_v1_0.asm"
